
## End User configurable options ###
SHELL = @SHELL@

@VPATH@
# Installation directories
prefix       = @prefix@
exec_prefix  = @exec_prefix@
bindir       = @bindir@
includedir   = @includedir@
libdir       = @libdir@
# Build directories
libbuild_dir = @libbuild_dir@
top_srcdir   = @top_srcdir@
srcdir       = @srcdir@

JC           = @JC@
JAR          = @JAR@
RM           = @RM@

TARGET0 = $(libbuild_dir)/slog2printrecur.jar
TARGET1 = $(libbuild_dir)/slog2printserial.jar
TARGET2 = $(libbuild_dir)/slog2navigator.jar
TARGET3 = $(libbuild_dir)/slog2perfdata.jar
TARGET4 = $(libbuild_dir)/slog2perftest.jar
PACKAGE = logformat.slog2.input
SRC     = IteratorOfGroupObjects.java TreeNode.java InputLog.java \
          BufStub.java TreeFloor.java \
          TreeFloorList.java TreeTrunk.java \
          PrintRecursively.java PrintSerially.java Navigator.java

OBJ     = $(SRC:.java=.class)

TS_SRC  = PerfData.java PerfTest.java

TS_OBJ  = $(TS_SRC:.java=.class)

.SUFFIXES:      .java .class .jar

# CLASSDIR is where classfiles are located, all counted from the top
SRCDIR     = $(top_srcdir)
CLASSDIR   = ../../..
CLASSPATH  = ../../..
PKGDIR     = logformat/slog2/input

JCFLAGS = -sourcepath @JPATH_START@$(SRCDIR)@JPATH_FINAL@ -classpath @JPATH_START@$(CLASSPATH)@JPATH_FINAL@ -d @JPATH_START@$(CLASSDIR)@JPATH_FINAL@ @JFLAGS@

.java.class:
	$(JC) $(JCFLAGS) $(JFLAGS) @JPATH_START@$<@JPATH_FINAL@

ALL: $(TARGET0) $(TARGET1) $(TARGET2)

test: $(TARGET3) $(TARGET4)

$(TARGET0): $(OBJ)
	cd $(CLASSDIR) && \
	$(RM) $(PACKAGE).manifest && \
	echo "Main-Class: $(PACKAGE).PrintRecursively" > $(PACKAGE).manifest ; \
	jarfile=@JPATH_START@$@@JPATH_FINAL@ ; \
	$(JAR) $(JARFLAGS)cfm $${jarfile} $(PACKAGE).manifest ; \
	for dir in base/io/ base/drawable/ logformat/slog2/ $(PKGDIR)/ ; do \
	    classdir_prefix=@JPATH_START@$${dir}@JPATH_FINAL@ ; \
	    $(JAR) $(JARFLAGS)uf $${jarfile} $${classdir_prefix}*.class ; \
	done

$(TARGET1): $(OBJ)
	cd $(CLASSDIR) && \
	$(RM) $(PACKAGE).manifest && \
	echo "Main-Class: $(PACKAGE).PrintSerially" > $(PACKAGE).manifest ; \
	jarfile=@JPATH_START@$@@JPATH_FINAL@ ; \
	$(JAR) $(JARFLAGS)cfm $${jarfile} $(PACKAGE).manifest ; \
	for dir in base/io/ base/drawable/ logformat/slog2/ $(PKGDIR)/ ; do \
	    classdir_prefix=@JPATH_START@$${dir}@JPATH_FINAL@ ; \
	    $(JAR) $(JARFLAGS)uf $${jarfile} $${classdir_prefix}*.class ; \
	done

$(TARGET2): $(OBJ)
	cd $(CLASSDIR) && \
	$(RM) $(PACKAGE).manifest && \
	echo "Main-Class: $(PACKAGE).Navigator" > $(PACKAGE).manifest ; \
	jarfile=@JPATH_START@$@@JPATH_FINAL@ ; \
	$(JAR) $(JARFLAGS)cfm $${jarfile} $(PACKAGE).manifest ; \
	for dir in base/io/ base/drawable/ logformat/slog2/ $(PKGDIR)/ ; do \
	    classdir_prefix=@JPATH_START@$${dir}@JPATH_FINAL@ ; \
	    $(JAR) $(JARFLAGS)uf $${jarfile} $${classdir_prefix}*.class ; \
	done

$(TARGET3): $(OBJ) $(TS_OBJ)
	cd $(CLASSDIR) && \
	$(RM) $(PACKAGE).manifest && \
	echo "Main-Class: $(PACKAGE).PerfData" > $(PACKAGE).manifest ; \
	jarfile=@JPATH_START@$@@JPATH_FINAL@ ; \
	$(JAR) $(JARFLAGS)cfm $${jarfile} $(PACKAGE).manifest ; \
	for dir in base/io/ base/drawable/ logformat/slog2/ $(PKGDIR)/ ; do \
	    classdir_prefix=@JPATH_START@$${dir}@JPATH_FINAL@ ; \
	    $(JAR) $(JARFLAGS)uf $${jarfile} $${classdir_prefix}*.class ; \
	done

$(TARGET4): $(OBJ) $(TS_OBJ)
	cd $(CLASSDIR) && \
	$(RM) $(PACKAGE).manifest && \
	echo "Main-Class: $(PACKAGE).PerfTest" > $(PACKAGE).manifest ; \
	jarfile=@JPATH_START@$@@JPATH_FINAL@ ; \
	$(JAR) $(JARFLAGS)cfm $${jarfile} $(PACKAGE).manifest ; \
	for dir in base/io/ base/drawable/ logformat/slog2/ $(PKGDIR)/ ; do \
	    classdir_prefix=@JPATH_START@$${dir}@JPATH_FINAL@ ; \
	    $(JAR) $(JARFLAGS)uf $${jarfile} $${classdir_prefix}*.class ; \
	done

clean:
	cd $(CLASSDIR) && \
	$(RM) $(PACKAGE).manifest $(PKGDIR)/*.class 

rmlib:
	$(RM) $(TARGET0) $(TARGET1) $(TARGET2) $(TARGET3)

realclean: clean rmlib

distclean: realclean
	@-$(RM) Makefile
